home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Floppyshop 2
/
Floppyshop - 2.zip
/
Floppyshop - 2.iso
/
diskmags
/
0022-3.564
/
dmg-3459
/
programs
/
gfa_trix
/
foob.lst
< prev
next >
Wrap
File List
|
1992-11-13
|
4KB
|
101 lines
' INLINE example source stuff by Richard Karsmakers
'
' INLINEs may be loaded by pressing HELP on the INLINE command, then "L" (Load)
'
' The INLINE below must, after merged in your program, be given the FOOB.INL file!
INLINE haal%,36
' The following INLINE must be fed the converted text (.INL) file
' The '300' value needs to vary according the length of your file
INLINE fetch%,300
'
ALERT 1,CHAR{@fetch(1)},1,"OK",d%
PRINT AT(10,10);CHAR{@fetch(1)}
'
FUNCTION fetch(no%)
DIM ddcr%(15) !Dimension register array
ddcr%(0)=no% !Number of text in D0
ddcr%(8)=fetch% !Address of INLINE text cluster
RCALL haal%,ddcr%() !Do it. haal% is FOOB.INL
het%=ddcr%(8) !A0 now contains the string address
ERASE ddcr%() !Get rid of array
RETURN het% !Give address back
ENDFUNC
PROCEDURE alg_to_inl
FILESELECT "A:\*.*","",lees$ !Get the .TXT file
schrijf$=LEFT$(lees$,LEN(lees$)-3)+"INL" !Create .INL file name
OPEN "I",#1,lees$ !Open the original text file
s%=LOF(#1) !Length of source file
OPEN "O",#2,schrijf$ !Open the target (.INL) file
l%=0 !Length of target file
t%=0 !Current position in source file
WHILE t%<s%
byte|=INP(#1)
INC t%
IF CHR$(byte|)="~" !Text number indicator found
OUT #2,0 !End previous text
INC l%
IF ODD(l%) !If odd, then even it out
OUT #2,0 ! with another zero
INC l%
ENDIF
nummer$=SPACE$(3) !Calculate the number
MID$(nummer$,1,1)=CHR$(INP(#1))
MID$(nummer$,2,1)=CHR$(INP(#1))
MID$(nummer$,3,1)=CHR$(INP(#1))
shit|=INP(#1) !Skip line feed and return
shit|=INP(#1)
ADD t%,5
nummer$=MKI$(VAL(nummer$))
PRINT #2,nummer$; !Write it
ADD l%,2
ELSE IF byte|=&HD
shit|=INP(#1) !Skip return
INC t%
ELSE IF byte|=34 !"
' do nothing
ELSE
OUT #2,byte| !No text indicator found,
INC l% ! so it's a standard character
ENDIF
WEND
OUT #2,&HFF
OUT #2,&HFF
OUT #2,&HFF
CLOSE #1
CLOSE #2
OPEN "I",#1,schrijf$
CLS
PRINT "Length of .INL file is ";LOF(#1)
CLOSE #1
a%=INP(2) !Wait for a key
RETURN
'
' Real exist
'
' Syntax example:
' @search_file("A:\YEAH\SURE.PRG")
' The result will be in exist! (TRUE if found, FALSE if not)
'
PROCEDURE search_file(filename$)
LOCAL adr%
adr%=VARPTR(filename$) !Give name to GEMDOS
IF GEMDOS(78,L:adr%,0)<0 !Do GEMDOS exist
exist!=FALSE !Not found
ELSE
exist!=TRUE !Found
ENDIF
RETURN
'
' Routine to get the name of your current program file
'
' Just call the routine. The name will be in NAM$)
'
PROCEDURE shel_read
nam$=SPACE$(200) !Buffer for actual name
cmd$=SPACE$(200) !Buffer for command
LPOKE ADDRIN,V:nam$ !Tell GEMSYS these addresses
LPOKE ADDRIN+4,V:cmd$
GEMSYS 120 !This function is called "SHELL_READ"
nam$=LEFT$(nam$,INSTR(nam$,CHR$(0))-1) !Get rid of needless trash
RETURN